import { Component, OnInit } from '@angular/core';

import { TestModalComponent } from '../test-modal/test-modal.component';
import { ModalMyService } from '../../../@shared/components/modal';

@Component({
  selector: 'app-card-list',
  templateUrl: './card-list.component.html',
  styleUrls: ['./card-list.component.scss'],
})
export class CardListComponent implements OnInit {
  constructor(private modalMyService: ModalMyService) {}

  ngOnInit() {}

  onOpenModal() {
    const results = this.modalMyService.open({
      id: 'modal-modal',
      width: '300px',
      backdropCloseable: true,
      showAnimate: false,
      component: TestModalComponent,
      onClose: () => {
        console.log('on modal closed.');
      },
      data: {
        content: 'Error: This is an error message, please take a look.',
        cancelBtnText: '我知道了',
        onClose: (event) => {
          results.modalInstance.hide();
        },
      },
    });
  }
}
